<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>会员登录</title>
<link href="${pageContext.request.contextPath}/css/common.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/css/login.css" rel="stylesheet" type="text/css" />
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
function checkUsername(){

	$.ajax({
		url:"${pageContext.request.contextPath}/loginFindByid.action",
		method:"post",
		data:{
			"username":$("#username").val()
		},
		success:function(response){
			console.log(response);
			let $zhuce=response.objectMap.zhuce;
			if(response.errorCode==="100"){
				$("#span1").text($zhuce).attr("style","color:green;");
			}else{
				$("#span1").text($zhuce).attr("style","color:red;");
			}
		},
		error:function(){
			console.log("请求发送失败..")
		}
	});
}

<%-- $(function(){
	let $ss='<%=request.getAttribute("messagePswS")%>';
	console.log($ss);
	if($ss=="修改成功"){
		alert("修改密码成功,请重新登录!");
		}
}); --%>

function creatXMLHttpreauest() {
	try {
		return new XMLHttpRequest();
	} catch (e) {
		try {
			return ActiveXObject("Msxml2.XMLHttp");
		} catch (e) {
			try {
				return ActiveXObject("micoresoftxml2.XMLHttp");
			} catch (e) {
				throw e;
			}
		}
	}
}
function change(){
		var img = document.getElementById("checkImg");
		img.src="${pageContext.request.contextPath}/checkImg.action?"+new Date();
	}
</script>
</head>
<body>
	<div class="container header">
		<div class="span5">
			<div class="logo">
				<a href="${pageContext.request.contextPath}/index.action"> <img
					src="${pageContext.request.contextPath}/image/r___________renleipic_01/logo.gif"
					alt=""></a>
			</div>
		</div>
		<div class="span9">
			
		</div>
		<%@ include file="menu.jsp"%>

	</div>
	<div class="container login">
		<div class="span12">
			<div class="ad">
				<img src="${pageContext.request.contextPath}/image/login.jpg" width="500" height="330" alt="会员登录"
					title="会员登录">
			</div>
		</div>
		<div class="span12 last">
			<div class="wrap">
				<div class="main">
					<div class="title">
						<strong>会员登录</strong>USER LOGIN
					</div>
					<form id="loginForm" method="post" 
					action="${pageContext.request.contextPath}/userLogin.action" novalidate="novalidate">
						<table>
							<tbody>
								<tr>
									<th>用户名/E-mail:</th>
									<td>
										<input type="text" id="username" name="username"
										class="text" maxlength="20"  onblur="checkUsername()" value="${userinfo.username}">
										<span id="span1"></span>
									</td>
								</tr>
								<tr>
									<th>密&nbsp;&nbsp;码:</th>
									<td><input type="password" id="password" name="password"
										class="text" maxlength="20" autocomplete="off" value="${userinfo.password}"></td>
								</tr>
								<tr>
									<th>验证码:</th>
									<td>
										<span class="fieldSet">
										<input type="text" id="captcha" name="checkImg" class="text captcha" maxlength="4" autocomplete="off">
										<img id="checkImg" class="captchaImage" src="${pageContext.request.contextPath}/checkImg.action"
													title="点击更换验证码" onclick="change()"> 
										</span>
									</td>
								</tr>
								<tr>
									<th>&nbsp;</th>
									<td><label> <input type="checkbox"
											id="isRememberUsername" name="isRememberUsername"
											value="true">记住用户名
									</label> <label> &nbsp;&nbsp;<a href="${pageContext.request.contextPath}/findpsw.action">找回密码</a>
									</label></td>
								</tr>
								<tr>
									<th></th>
									<td style="color:#ff0000;"><input type="submit" class="submit" value="登 录">
									&nbsp;${message}
									</td>
								</tr>
								<tr class="register">
									<th>&nbsp;</th>
									<td>
										<dl>
											<dt>还没有注册账号？</dt>
											<dd>
												立即注册即可体验在线购物！ <a href="${pageContext.request.contextPath}/regist.action">立即注册</a>
											</dd>
										</dl>
									</td>
								</tr>
							</tbody>
						</table>
					</form>
				</div>
			</div>
		</div>
	</div>
	<div class="container footer">
		<div class="span24">
			
		</div>
		<div class="span24">
			<ul class="bottomNav">
				<li><hr></hr></li>
			</ul>
		</div>
		<div class="span24">
			<div class="copyright">Copyright ©  网上商城 版权所有</div>
		</div>
	</div>
</body>
</html>